package com.gy.education.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.gy.education.R;
import com.gy.education.home.bean.FriendBean;

import java.util.List;

/**
 * 作者：gy on 16/7/13
 * 说明：好友列表
 */
public class MyFriendAdapter extends BaseAdapter {

    private Context context;
    private List<FriendBean> list;

    public MyFriendAdapter(Context context, List<FriendBean> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
//        return list.size();
        return 10;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHoder holder;
        if(view == null){
            holder = new ViewHoder();
            view = View.inflate(context, R.layout.adapter_my_friend,null);
            holder.img = (ImageView) view.findViewById(R.id.adapter_my_friend_img_icon);
            holder.tvName = (TextView) view.findViewById(R.id.adapter_my_friend_tv_name);
            holder.tvContent = (TextView) view.findViewById(R.id.adapter_my_friend_tv_content);
            view.setTag(holder);
        } else {
            holder = (ViewHoder) view.getTag();
        }
        if(i % 2 == 0){
            holder.tvName.setText("♂  这是名字");
        } else {
            holder.tvName.setText("♀  这是名字");
        }

        return view;
    }

    class ViewHoder{
        ImageView img;
        TextView tvName,tvContent;
    }
}
